import {
  useParams,
  useLocation,
  useNavigate,
  useSearchParams,
} from "react-router-dom";

export default function withRouter(Component) {
  // 相当于给 MyCard组件添加各种props属性，还添加三个重要的属性params,location,navigate

  return (props) => (
      <Component
          {...props}
          searchParams={useSearchParams()}
          params={useParams()}
          location={useLocation()}
          navigate={useNavigate()}
      />
  );
}